import 'dart:convert';

import 'package:base_lib/common/index.dart';
import 'package:base_lib/config.dart';
import 'package:doctor_user_lib/repository/user_net_intercept.dart';

class DoctorUserHttp {
  static HttpManager _httpProxyIns;

  static createHttpProxy(
      {mBaseUrl = Config.loginBaseUrl,
      codeName = Config.codeName,
      codeSuccessValue = Config.codeSuccessValue,
      msgName = Config.msgName,
      reqTimeOut = Config.reqTimeOut,
      respTimeOut = Config.respTimeOut,
      logTag = "prescribe"}) {
    _httpProxyIns = HttpManager(mBaseUrl,
        CODE_NAME: codeName,
        CODE_SUCCESS_VALUE: codeSuccessValue,
        MSG_NAME: msgName,
        REQ_TIME_OUT: reqTimeOut,
        RESP_TIME_OUT: respTimeOut,
        LOG_TAG: logTag,
        defaultInterceptors: [UserNetIntercept()]);
  }

  /// 退出登录
  static const PEACHUSER_POST_DOCTOR_LOGOUT = "api/peachUser/doctor/logout";

  /// 线下新建检查单
  static Future logOut(Map<String, dynamic> params) {
    return _httpProxyIns.postJson(PEACHUSER_POST_DOCTOR_LOGOUT, (resMap) {
      return resMap;
    }, jsonData: json.encode(params));
  }
}
